#include<stdio.h>
#include <fcntl.h>
#include <unistd.h>


int main()
{
    // int open(const char *pathname, int flags, mode_t mode);
    int fd = open("bite.txt",O_WRONLY|O_CREAT|O_APPEND,0666);
    if(fd ==-1)
    {
        printf("oprn fail\n");
        return 1;
    }
    const char buf[]="jiejie2021";
    int cnt = sizeof(buf)/sizeof(buf[0]);
    ssize_t wt = write(fd,  buf, cnt);
    close(fd);
    int sfd = open("bite.txt",O_RDONLY|O_CREAT|O_APPEND,0666);
    char bf[16];
    ssize_t rd = read(sfd, (void*)bf,cnt);
    printf("%s\n",bf);
    close(sfd);
    return 0;
}